home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CThingBase.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  4.9 KB  |  224 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Audio.CAudio;
  4.    import Local.CGlobal;
  5.    import Local.Game.CGame;
  6.    import Local.Game.Level.CLevel;
  7.    import Local.Game.World.CLandscape;
  8.    import Local.Game.World.CWorld;
  9.    import Local.Game.World.Map.CMap;
  10.    import flash.events.Event;
  11.    import flash.events.EventDispatcher;
  12.    
  13.    public class CThingBase extends EventDispatcher
  14.    {
  15.       
  16.       private static var _Game:CGame;
  17.       
  18.       private static var _Landscape:CLandscape;
  19.       
  20.       public static const DISPOSED:String = "DISPOSED";
  21.       
  22.       public static var mAllocateID:int = 5;
  23.       
  24.       public static var mEnemySpeed:Number = 1;
  25.       
  26.       public static const DEATH:String = "DEATH";
  27.       
  28.       private static var _World:CWorld;
  29.       
  30.       public static var mGameTick:int = 0;
  31.       
  32.       private static var _Map:CMap;
  33.       
  34.       public static const SECONDS:int = 25;
  35.       
  36.       {
  37.          if(true)
  38.          {
  39.             DISPOSED = "DISPOSED";
  40.             if(true)
  41.             {
  42.                DEATH = "DEATH";
  43.                if(true)
  44.                {
  45.                   mAllocateID = 5;
  46.                   SECONDS = 25;
  47.                }
  48.                mGameTick = 0;
  49.             }
  50.             mEnemySpeed = 1;
  51.          }
  52.       }
  53.       
  54.       public var nID:int;
  55.       
  56.       public var _Life:int;
  57.       
  58.       public var mName:String;
  59.       
  60.       public var OnDispose:Function;
  61.       
  62.       public var mSelectable:Boolean;
  63.       
  64.       public var mScore:int;
  65.       
  66.       public var mDisposed:Boolean;
  67.       
  68.       public var OnDeath:Function;
  69.       
  70.       public var mBaseType:String;
  71.       
  72.       public var mKilledBy:*;
  73.       
  74.       public var mType:String;
  75.       
  76.       public var mID:String;
  77.       
  78.       public var mMaxLife:int;
  79.       
  80.       public var Process:Function;
  81.       
  82.       public var nProcessID:int;
  83.       
  84.       public function CThingBase()
  85.       {
  86.          super();
  87.          nID = ++mAllocateID;
  88.          mID = "T" + nID;
  89.       }
  90.       
  91.       public static function set mGame(param1:CGame) : void
  92.       {
  93.          if(true)
  94.          {
  95.             _Game = param1;
  96.             if(true)
  97.             {
  98.                _World = _Game.mWorld;
  99.                _Map = _World.mMap;
  100.             }
  101.             _Landscape = _World.mLandscape;
  102.          }
  103.       }
  104.       
  105.       public static function Restart() : void
  106.       {
  107.          mAllocateID = 0;
  108.       }
  109.       
  110.       public function get mLevel() : CLevel
  111.       {
  112.          return _World.mLevel;
  113.       }
  114.       
  115.       public function set mLife(param1:int) : void
  116.       {
  117.          ┬º┬ºpush(param1);
  118.          ┬º┬ºpush(0);
  119.          if(true)
  120.          {
  121.             if(┬º┬ºpop() <= ┬º┬ºpop() && _Life > 0)
  122.             {
  123.                dispatchEvent(new Event(DEATH));
  124.             }
  125.             _Life = param1;
  126.             return;
  127.          }
  128.          ┬º┬ºgoto(addr26);
  129.       }
  130.       
  131.       public function get mGame() : CGame
  132.       {
  133.          return _Game;
  134.       }
  135.       
  136.       public function get mWorld() : CWorld
  137.       {
  138.          return _World;
  139.       }
  140.       
  141.       public function get mExists() : Boolean
  142.       {
  143.          return !(mDead || mDisposed);
  144.       }
  145.       
  146.       public function get mLife() : int
  147.       {
  148.          return _Life;
  149.       }
  150.       
  151.       public function get mMap() : CMap
  152.       {
  153.          return _Map;
  154.       }
  155.       
  156.       public function get mLandscape() : CLandscape
  157.       {
  158.          return _Landscape;
  159.       }
  160.       
  161.       public function IncrementKill() : uint
  162.       {
  163.          return CGlobal.IncrementStat("kill_" + mType);
  164.       }
  165.       
  166.       public function IncrementBuild() : uint
  167.       {
  168.          return CGlobal.IncrementStat("build_" + mType);
  169.       }
  170.       
  171.       public function set mDead(param1:Boolean) : void
  172.       {
  173.          if(true)
  174.          {
  175.             if(param1)
  176.             {
  177.                mLife = 0;
  178.             }
  179.          }
  180.       }
  181.       
  182.       public function IncrementDeath() : uint
  183.       {
  184.          return CGlobal.IncrementStat("death_" + mType);
  185.       }
  186.       
  187.       public function IncrementFired() : uint
  188.       {
  189.          return CGlobal.IncrementStat("fired_" + mType);
  190.       }
  191.       
  192.       public function get mAudio() : CAudio
  193.       {
  194.          return _Game.mAudio;
  195.       }
  196.       
  197.       public function get mDead() : Boolean
  198.       {
  199.          return _Life <= 0;
  200.       }
  201.       
  202.       public function IncrementReachedObjective() : uint
  203.       {
  204.          return CGlobal.IncrementStat("robj_" + mType);
  205.       }
  206.       
  207.       public function Dispose() : void
  208.       {
  209.          if(true)
  210.          {
  211.             if(!mDisposed)
  212.             {
  213.                if(true)
  214.                {
  215.                   mDisposed = true;
  216.                   mLife = 0;
  217.                }
  218.                dispatchEvent(new Event(DISPOSED));
  219.             }
  220.          }
  221.       }
  222.    }
  223. }
  224.